drawingarea: Update docs around background handling
authorMatthias Clasen <mclasen@redhat.com>
Sun, 21 Feb 2016 05:46:54 +0000 (00:46 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 21 Feb 2016 05:46:54 +0000 (00:46 -0500)
The behavior changed this cycle. Update the docs to recommend
an explicit gtk_render_background call.

gtk/gtkdrawingarea.c

index 36ec5b8db546b3041053806e84a8da35fa818727..261bf344798121a25c4d6ed1d1c20febddc0a45b 100644 (file)
  * area to display a circle in the normal widget foreground
  * color.
  *
- * Note that GDK automatically clears the exposed area to the
- * background color before sending the expose event, and that
- * drawing is implicitly clipped to the exposed area.
+ * Note that GDK automatically clears the exposed area before sending
+ * the expose event, and that drawing is implicitly clipped to the exposed
+ * area. If you want to have a theme-provided background, you need
+ * to call gtk_render_background() in your ::draw method.
  *
  * ## Simple GtkDrawingArea usage
  *
  * {
  *   guint width, height;
  *   GdkRGBA color;
+ *   GtkStyleContext *context;
+ *
+ *   context = gtk_widget_get_style_context (widget);
  *
  *   width = gtk_widget_get_allocated_width (widget);
  *   height = gtk_widget_get_allocated_height (widget);
+ *
+ *   gtk_render_background (context, cr, 0, 0, width, height);
+ *
  *   cairo_arc (cr,
  *              width / 2.0, height / 2.0,
  *              MIN (width, height) / 2.0,
  *              0, 2 * G_PI);
  *
- *   gtk_style_context_get_color (gtk_widget_get_style_context (widget),
- *                                0,
+ *   gtk_style_context_get_color (context,
+ *                                gtk_style_context_get_state (context),
  *                                &color);
  *   gdk_cairo_set_source_rgba (cr, &color);
  *